package com.spicdt.edge.protocol.door.demo.utils;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.json.JSONUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.spicdt.edge.protocol.door.demo.model.dto.StaffInfoDTO;
import com.spicdt.edge.protocol.door.demo.model.po.Staff;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Author saluteAlex
 * @Date 2025/6/23 15:25
 */
public class TEST {
    public static void main(String[] args) {
        StaffInfoDTO staffInfoDTO = new StaffInfoDTO();
        List<Staff> staffList=new ArrayList<>();
        Staff staff = new Staff();
        staff.setId("6");
        staff.setStaffName("李四");
        staff.setStaffID("2006110327");

        Staff staff1 = new Staff();
        staff1.setId("7");
        staff1.setStaffName("张三");
        staff1.setStaffID("2006110328");


        staffList.add(staff);
        staffList.add(staff1);
        staffInfoDTO.setStaff(staffList);
        Map<String, Object> stringObjectMap = BeanUtil.beanToMap(staffInfoDTO);
        String jsonStr3 = JSONUtil.toJsonStr(stringObjectMap);
        System.out.println(jsonStr3);

    }
}
